import platformRequest from "@/utils/platformRequest";

// 查询所有商家分类
export const selectAllMerchantCategory = () =>
  platformRequest({
    'url':'/shopCategory/list',
    'method':'get'
  })

// 平台端商家分页查询
export const getMerchantCategoryInfo = (page:number, pageSize:number, shopCategoryId:number, shopName:string, status:number) =>
  platformRequest({
    'url':'/shop/page',
    'method':'get',
    params:{
      page,
      pageSize,
      shopCategoryId,
      shopName,
      status
    }
  })

export const addMerchant = (data) =>
  platformRequest({
    'url':'/shop',
    'method':'post',
    data:data
  })

export const updateMerchant = (data:any) =>
  platformRequest({
    url:'/shop',
    method:'put',
    data:data
  })

export const getMerchantInfoById = (id:number) =>
  platformRequest.get(`/shop/${id}`)

export const deleteMerchants = (merchantArray:number[]) =>
  platformRequest.delete('/shop?ids='+merchantArray.join(','))

export const updateMerchantStatus = (params:{status:number, id:number}) =>
  platformRequest.post(`/shop/status/${params.status}?id=${params.id}`)


